// DataSet.h: interface for the DataSet class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DATASET_H__919AF5CB_8094_43BB_B90D_EA126F880938__INCLUDED_)
#define AFX_DATASET_H__919AF5CB_8094_43BB_B90D_EA126F880938__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ModelObject.h"

class AFX_EXT_CLASS DataSet  
{
public:
	DataSet();
	virtual ~DataSet();

public:
	void SetDataStandard(const CString& strStandardID){
		if(!strStandardID.IsEmpty())
			m_strStandardID = strStandardID;
	}

	CString& GetDataStandard(){
		return m_strStandardID;
	}

	CString GetSourceURL();

private:
	CString m_strStandardID;
};

class AFX_EXT_CLASS PropertyDataSet : public DataSet
{
public:
	PropertyDataSet(){}
	~PropertyDataSet(){ASSERT(m_rs == NULL);}

public:
	virtual BOOL InitProperty(ModelObject& object);
	void Close();

protected:
	template <class StandardType> StandardType* GetStandard(StandardType* pType)
	{
		ASSERT(!this->GetDataStandard().IsEmpty());
		ProductCatalog* pCatalog = ProductCatalogManager::Instance()->
			GetProductCatalog(this->GetDataStandard());
		ASSERT(pCatalog);
		
		Standard* pStandard = GetPersistentFacade().GetStandardGenerator()->Generate(pCatalog);
		ASSERT(pCatalog);
				
		return static_cast<StandardType*>(pStandard);
	}

protected:
	_RecordsetPtr m_rs;
	CStringArray m_theTables;
};
#endif // !defined(AFX_DATASET_H__919AF5CB_8094_43BB_B90D_EA126F880938__INCLUDED_)
